import { Global, Module } from '@nestjs/common';
import { JwtModule, JwtService } from '@nestjs/jwt';
import { ScheduleModule } from '@nestjs/schedule';
import database from './database';
import { TerminusModule } from '@nestjs/terminus';
import { BullModule } from '@nestjs/bull';
import { CommonService } from './common.service';
// import { join } from 'path';
// import { ConfigModule } from '@nestjs/config';
import { CommonController } from './common.controller';
import md5 from 'md5'
import config from 'src/config/config';
import { uploadUtil } from 'src/util/upload.util';
// console.log(join(__dirname, '/static', 'client'));
@Global() 
@Module({
  imports: [
    JwtModule.register({
      secret: md5('19980726'),
    }),
    BullModule.registerQueue({
      name: 'audio',
      redis: {
        host: config.REDIS_HOST,
        port: config.REDIS_PORT,
        password: config.MYSQL_PASSWORD,
        db: 10,
      },
    }),
    ScheduleModule.forRoot(),
    database.init,
    TerminusModule,
  ],
  providers: [CommonService,uploadUtil],
  exports: [CommonService],
  controllers: [CommonController],
})
export class CommonModule {}
